package org.lds.hotkey.worker.component;

import lombok.extern.slf4j.Slf4j;
import org.lds.hotkey.common.util.ScheduledUtil;
import org.lds.hotkey.worker.holder.AppInstanceHolder;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class GetAndWatchAppInstanceRunner implements ApplicationRunner {

    @Override
    public void run(ApplicationArguments args) throws Exception {
        ScheduledUtil.defaultClosableScheduled(() -> AppInstanceHolder.start());
    }
}
